using System;
using System.Xml;
using System.Xml.Serialization;
using rlTodayMakeSkin.Project.Attributes;

namespace rlTodayMakeSkin.Project.XmlElement.XmlSubElements
{
    /// <summary>
    /// Represents a sub elmenent that specifices
    /// </summary>
    public class OnClick : XmlSubElement
    {

        private string destFile = "";
        private string command = "";


        public OnClick(rlTodayXmlElement parent, string destClick, string cmd) : base(parent)
        {
            destFile = destClick;
            command = cmd;
        }

        public OnClick(XmlAttributeCollection listAttr, rlTodayXmlElement parent)
            : base(parent)
        {
            if (listAttr["File"] != null) destFile = listAttr["File"].Value;
            if (listAttr["Command"] != null) command = listAttr["Command"].Value;
        }

        public OnClick(rlTodayXmlElement parent) : base(parent)
        {

        }

        /// <summary>
        /// for the serialization
        /// </summary>
        public OnClick() { }

        /// <summary>
        /// The application which will be executed on click. Full path!
        /// </summary>
        [PropertyDescription("Gets, sets a string that rapresent the application which will be executed when clicking.")]
        [XmlAttribute("File")]
        public string OnClickFile
        {
            get { return destFile;}
            set { destFile = value; }
        }

        /// <summary>
        /// The optional parameters for the application.
        /// </summary>
        [PropertyDescription("The optional parameters for the application .")]
        [XmlAttribute("Command")]
        public string OnClickCommand
        {
            get { return command; }
            set { command = value; }
        }

        public override bool isEmpty()
        {
            return destFile == "";
        }
    }
}
